import Cesium from "cesium/Cesium";
import { GET_EARTH,GET_SIDER_STATE } from "./types";

let viewer;
export const getEarth = () => dispatch =>{
        viewer = new Cesium.Viewer( "cesiumContainer",{
        geocoder : false, //地域搜索
        homeButton : false,//返回默认相机位置
        sceneModePicker : false,//场景模式之间切换
        baseLayerPicker : false,//图层选择
        navigationHelpButton : false,//帮助说明
        animation : false,//动画
        timeline : false,//场景轴
        fullscreenButton : false,//全屏按钮
        vrButton : false,//VR对比功能
        CreditDisplay : false,
        shouldAnimate : true,
        terrainProvider: Cesium.createWorldTerrain({
            requestVertexNormals: true
        })
    });
    viewer._cesiumWidget._creditContainer.style.display = "none";  //	去除版权信息

    dispatch({
        type:GET_EARTH,
        viewer:viewer
    })
};

export const siderState = collapsed => dispatch =>{
    dispatch({
        type:GET_SIDER_STATE,
        collapsed:collapsed
    })
};